<?php
/**
 *This page is biuld for customers choose Gyms
 */
$cs = Yii::app()->getClientScript();
$cs->registerCSSFile(Yii::app()->request->baseUrl . '/css/mobile/booking_find_1.css');
$cs->registerCSSFile(Yii::app()->request->baseUrl . '/css/mobile/booking_list.css');
$screen = Blyn::app()->getUIManager()->getCurrentScreen();
$wxControl = $screen->getChildControl('BUIWXControl_1');
$data = array();
if(isset($nowCity)) {
    $data['nowCity'] = $nowCity;    //获取用户当前所选的的城市，用于返回时确定城市
}
$findUrl = $wxControl->getLinkUrl(array('name' => 'find','id' => 'booking_find_1'),$data);
$eventList = Blyn::app()->getActiveApp()->getEventList();
$courtTypeList = Blyn::app()->getActiveApp()->getCourtTypeList();
$findTextArr = array();
$itemData = explode(' ',$findText);
foreach ($itemData as $value) {
    $condition = explode('=',$value);
    $findTextArr[$condition[0]] = $condition[1];
}
$courtTypeCh = $courtTypeList[$findTextArr['courtType']];
?>
<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="full-screen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<link href="style/index.css" rel="stylesheet">
<style>
    body {background-color: #EAEAEA;}
    li {list-style: none;}
    #content{width:100%;}
    .box{width:90%;border-radius:8px;background-color:white;text-align:center;margin:15px auto;}
    .box_content{width:95%;padding-top: 10px;text-align:center;margin:0px auto;}
    .box_img{width:40%;height:100px;margin:0px;float:left;margin-left:-5px;}
    ul.box_text{float:left;padding-left:15px;}
    ul.box_text li{color:#82BB6C;font-size:18px;font-weight:bold;letter-spacing:2px;font-family:"微软雅黑";line-height:25px;width:auto;}
    .star{width:auto;height:25px;display:inline-block;overflow:hidden;float:left;padding-left:5px;padding-top:5px;}
    .star span{width:8px;height:16px;float:left;overflow:hidden;display:inline-block;}
    .star span.half{background-position:0 0;background:url(<?php echo Yii::app()->request->baseUrl.'/images/BWeSport/star.png';?>) no-repeat 0px 0px;}
    .star span.on{background-position:-8px 0;background:url(<?php echo Yii::app()->request->baseUrl.'/images/BWeSport/star.png';?>) no-repeat -10px 0px;}
    .star span.no{background-position:-28px 0;background:url(<?php echo Yii::app()->request->baseUrl.'/images/BWeSport/star.png';?>) no-repeat -20px 0px;}
    .star span.text{color:red;font-size:14px;margin-left:5px;line-height:22px;width:32px;}
    .button{display:inline-block;}
    .button span{color:white;font-size:14px;font-family:"微软雅黑";line-height:22px;margin:5px;padding:3px;}
    .button span.b{background-color:#82BB6C;border-radius:5px;}
    .address{width:100%;overflow:hidden;margin-top: 5px;}
    .address span{width:auto;display:inline-block;overflow:hidden;float:left;line-height:25px;}
    .address span.qu{color:#82BB6C;font-size:14px;font-family:"微软雅黑";}
    .address span.lu{color:#A5A1A7;font-size:14px;font-family:"微软雅黑";}
    
    .box_content table {margin: 0;padding: 0;width: 100%;text-align: left;}
    .court_img {width: 125px;}
    .title {color:#82BB6C;font-size:18px;font-weight:bold;letter-spacing:2px;font-family:"微软雅黑";line-height:25px;width:auto;}
</style>
<body>
    <header class="navbar">
        <div class="nav-wrap-left">
            <a class="react back" href="<?php echo $findUrl;?>"><i class="text-icon icon-back"></i></a>
        </div>
        <h1 class="nav-header">选择场馆</h1>
        <?php $wxControl->renderView('booking_navigation', array());?>
    </header>
    <div id="content"><?php
        foreach ($eventList as $event) {
            $eventId = $event->getId();
            $eventName = $event->getName();
            $findTextArr['eventId'] = $eventId;
            $vender = $event->getMessageManager()->getMessage('vender');
            $vendeImage = $vender->getMediaManager()->getMedia('image')->getContent();
            $venderName = $vender->getMediaManager()->getMedia('venderName')->getContent();
            $venderPhone = $vender->getMediaManager()->getMedia('venderPhone')->getContent();//电话
            $venueAddress = $vender->getMediaManager()->getMedia('venueAddress')->content;//场馆地址
            $findText = '';
            foreach($findTextArr as $key => $value) {
                $findText .= $findText ? ' '.$key.'='.$value : $key.'='.$value;
            }
            $linkUrl = $wxControl->getLinkUrl(array(
                'name' => $eventName,
                'id' => 'showAddBooking_1'), array(
                'backPage' => 'booking_list_by_day',
                'findText' => $findText,
                'flagText' => $eventName.'('.$courtTypeCh.')',
                'nowCity' => $nowCity  //通常是省市拼音，如：china.chongqing
            ));?>
            <a href="<?php echo $linkUrl;?>">
                <div class="box">
                    <div class="box_content">
                        <table class="item">
                            <tr>
                                <td rowspan="3" class="court_img"><img src="<?php echo Yii::app()->request->baseUrl.$vendeImage;?>" width="116" height="88"/></td>
                                <td class="title"><?php echo $venderName; ?></td>
                            </tr>
                            <tr>
                                <td>
                                    <div class="star">
                                        <span class="half"></span>
                                        <span class="on"></span>
                                        <span class="half"></span>
                                        <span class="on"></span>
                                        <span class="half"></span>
                                        <span class="on"></span>
                                        <span class="half"></span>
                                        <span class="on"></span>
                                        <span class="half"></span>
                                        <span class="no"></span>
                                        <span class="text">9.5</span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div class="button"><span class="b">停车</span></div>
                                    <div class="button"><span class="b">卖品</span></div>
                                    <div class="button"><span class="b">器材</span></div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div class="address">
                                        <span class="qu">联系电话：</span>
                                        <span class="lu"><?php echo $venderPhone;?></span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div class="address">
                                        <span class="qu">场馆地址：</span>
                                        <span class="lu"><?php echo $venueAddress;?></span>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>	
                </div>
            </a><?php
        }?>
    </div>
    <footer>
        <div class="footer-copyright">
            <div class="hr"></div>
            <span class="footer-copyright-text">
			Copyright © 2014 billyn.net </span>
        </div>
    </footer>
</body>
</html>